Type isomorphisms simplify XML programming

نویسندگان

  • Frank Atanassow
  • Johan Jeuring
چکیده

A program that processes XML documents can be implemented using an XML data binding. Programming with an XML data binding can be painful, because the classes or types generated by the data binding are not in the style native to the host language. JAXB, a Java-XML data binding, supports binding customizations to mitigate this problem. Programming with a type-safe binding such as our HaskellXML data binding is even worse. To address this problem, rather than employing binding customizations, we exploit the theory of type isomorphisms to generically produce conversions between the complex datatypes generated by our binding, and more conventional Haskell-style datatypes. We give a Generic Haskell program that produces, for many pairs of canonically isomorphic types, the requisite pair of isomorphisms. This approach obviates the practical need for binding customizations and simplifies XML programming with a type safe Haskell-XML binding. Furthermore, a straightforward generalization of this technique allows us to treat schema subtyping in a simple way.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Inferring Type Isomorphisms Generically — With an application to an XML Schema–Haskell data binding

1 1 Introduction Typed functional languages like Haskell [35] and ML [24,33] typically support the declaration of user-defined, polymorphic algebraic datatypes. In Haskell, for example, we might define a datatype representing dates in a number of ways. The most straightforward and conventional definition is probably the one given by Date below,

متن کامل

Customizing an XML-Haskell data binding with type isomorphism inference in Generic Haskell

This paper introduces a type-preserving XML Schema–Haskell data binding (or, translation) UUXML, and shows how to customize it by exploiting the theory of canonical isomorphisms to automatically infer coercions between the machine-generated types and an equivalent, more natural, user-defined set of types. We show how to implement the inference mechanism in Generic Haskell.

متن کامل

Inferring Type Isomorphisms Generically

Datatypes which differ inessentially in their names and structure are said to be isomorphic; for example, a ternary product is isomorphic to a nested pair of binary products. In some canonical cases, the conversion function is uniquely determined solely by the two types involved. In this article we describe and implement a program in Generic Haskell which automatically infers this function by n...

متن کامل

Maintaining XML Data Integrity in Programs An Abstract Datatype Approach

In service-oriented loosely coupled distributed information systems, the format and semantics of the exchanged data become more and more important. We envisage that there will be an increasing number of general and domain-specific XML-based data formats for service-oriented computing. A typical example is a tax declaration form. If the schemas defining the formats specify structural and additio...

متن کامل

From Reversible Programs to Univalent Universes and Back

We establish a close connection between a reversible programming language based on type isomorphisms and a formally presented univalent universe. The correspondence relates combinators witnessing type isomorphisms in the programming language to paths in the univalent universe; and combinator optimizations in the programming language to 2-paths in the univalent universe. The result suggests a si...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2003